<template>
  <div class="goods-add">
    <div class="goods-add-content">
      <el-form
      ref="formRef"
      class="goods-add-form"
      label-width="auto"
      :model="formData"
    >
      <div class="from-sub-title">配送信息</div>
      <el-row>
        <el-col :span="10">
          <el-form-item label="用户信息" label-position="right">
            <span style="margin-right: 12px;">{{ formData.nickname }}</span>
            <span>{{ formData.phone }}</span>
          </el-form-item>
        </el-col>
        <el-col :span="10">
          <el-form-item label="订单状态" label-position="right">
            <span>{{ statusOption[formData.status] }}</span>
          </el-form-item>
        </el-col>
        <el-col :span="10">
          <el-form-item label="收货人信息" label-position="right" v-if="formData.addressInfo">
            <span style="margin-right: 12px;">{{ formData.addressInfo.name }}</span>
            <span style="margin-right: 12px;">{{ formData.addressInfo.phone }}</span>
            <span>{{ formData.addressInfo.province }} {{ formData.addressInfo.city }} {{ formData.addressInfo.district }} {{ formData.addressInfo.detail }}</span>
          </el-form-item>
        </el-col>
        <el-col :span="10">
          <el-form-item label="创建时间" label-position="right">
            <span>{{ formData.gmtCreate }}</span>
          </el-form-item>
        </el-col>
        <el-col :span="10">
          <el-form-item label="买家备注" label-position="right">
            <span>{{ formData.note }}</span>
          </el-form-item>
        </el-col>
      </el-row>
        <el-tabs v-model="activeName" class="demo-tabs">
            <el-tab-pane label="订单信息" name="1">
              <el-row>
                <el-col :span="24">
                  <el-form-item label="订单编号" label-position="right">
                    <span>{{ formData.orderNo }}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="24">
                  <el-form-item label="支付状态" label-position="right">
                    <span>{{ formData.status==1?'待付款':'已付款' }}</span>
                  </el-form-item>
                </el-col>
                <el-col :span="24">
                  <el-form-item label="支付方式" label-position="right">
                    <span>{{ formData.payType==1?'钱包余额':formData.payType==2?'纯积分':formData.payType==12?'微信小程序支付':'-' }}</span>
                  </el-form-item>
                </el-col>
              </el-row>
            </el-tab-pane>
            <el-tab-pane label="关联商城会员" name="2">
              <el-row>
                <el-col :span="10">
                  <el-form-item label="他的上一级" label-position="right">
                    <span>-</span>
                  </el-form-item>
                </el-col>
                <el-col :span="10">
                  <el-form-item label="绑定时间" label-position="right">
                    <span>-</span>
                  </el-form-item>
                </el-col>
                <el-col :span="10">
                  <el-form-item label="他的上上一级" label-position="right">
                    <span>-</span>
                  </el-form-item>
                </el-col>
                <el-col :span="10">
                  <el-form-item label="绑定时间" label-position="right">
                    <span>-</span>
                  </el-form-item>
                </el-col>
              </el-row>
            </el-tab-pane>
            <el-tab-pane label="分享赚信息" name="3">
              <el-row>
                <el-col :span="8">
                  <el-form-item label="总返利比例" label-position="right">
                    <span>-</span>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="总返利金额" label-position="right">
                    <span>-</span>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="结算周期" label-position="right">
                    <span>-</span>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="他的上一级" label-position="right">
                    <span>-</span>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="一层返利金额" label-position="right">
                    <span>-</span>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="一层返利比例" label-position="right">
                    <span>-</span>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="他的上上一级" label-position="right">
                    <span>-</span>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="二层返利金额" label-position="right">
                    <span>-</span>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="二层返利比例" label-position="right">
                    <span>-</span>
                  </el-form-item>
                </el-col>
              </el-row>
            </el-tab-pane>
            <el-tab-pane label="商品" name="4">
              <el-table :data="formData.itemList" style="font-size: 12px;">
                <el-table-column label="商品" min-width="300">
                  <template #default="{ row }">
                    <div style="display: flex;position: relative;">
                      <div class="sku-img-wrap" >
                        <img :src="row.coverImg" />
                      </div>
                      <div class="sku_item_info">
                        <div class="sku_item_name" :title="row.productName">
                            {{ row.productName }}
                        </div>
                        <div>规格：{{ row.wholeName }}</div>
                        <div>单价：{{ row.price }}</div>
                        <div>数量：{{ row.num }}</div>
                        <div>商品编码：{{ row.platId }}</div>
                      </div>
                    </div>
                  </template>
                </el-table-column>
                <el-table-column label="售价（元）">
                  <template #default="{ row }">
                    {{ row.price }}
                  </template>
                </el-table-column>
                <el-table-column label="黑卡优惠（元）">
                  <template #default="{ row }">
                    {{ row.aa }}
                  </template>
                </el-table-column>
                <el-table-column label="红卡优惠（元）">
                  <template #default="{ row }">
                    {{ row.aa }}
                  </template>
                </el-table-column>
                <el-table-column label="蓝卡优惠（元）">
                  <template #default="{ row }">
                    {{ row.aa }}
                  </template>
                </el-table-column>
                <el-table-column label="优惠券优惠（元）">
                  <template #default="{ row }">
                    {{ row.aa }}
                  </template>
                </el-table-column>
                <el-table-column label="积分抵扣（元）">
                  <template #default="{ row }">
                    {{ row.aa }}
                  </template>
                </el-table-column>
                <el-table-column label="实收金额（元）" width="150px">
                  <template #default="{ row }">
                    {{ row.price }}
                  </template>
                </el-table-column>
              </el-table>
              <div class="teble_bottom">
                <div>运费</div>
                <div style="width: 150px;">0</div>
              </div>
              <div class="teble_bottom">
                <div>总计</div>
                <div style="width: 150px;">0</div>
              </div>
            </el-tab-pane>
            <!-- <el-tab-pane label="留言" name="5"></el-tab-pane>
            <el-tab-pane label="操作日志" name="6"></el-tab-pane> -->
            
          </el-tabs>
    </el-form>
    
  </div>
  <div class="footer-wrap">
      <el-button size="default" @click="backNext">返回</el-button>
      <el-button  size="default" type="primary" >作废</el-button>
    </div>
  </div>
</template>
<script lang="ts" setup>
import { reactive, ref } from 'vue'
import {  getOrderDetail } from '@/api/order/index.js'
import useTagsViewStore from '@/store/modules/tagsView'
import router from '@/router'

const { proxy } = getCurrentInstance();

const id = proxy.$route.query.id

const formRef = ref(null);
let formData = ref({})
const options = ref([
  { label: '待付款', value: 1 },
  { label: '待发货', value: 2 },
  { label: '待收货', value: 3 },
  { label: '待评价', value: 4 },
  { label: '已完成', value: 5 },
  { label: '已取消', value: 6 },
])
const activeName = ref('1')

const statusOption = reactive({
  '1':'待付款',
  '2':'待发货',
  '3':'待收货',
  '4':'待评价',
  '5':'已完成',
  '6':'已取消',
})
getOrderDetail({ id }).then(res => {
  formData.value = res.data
})
const backNext = () => {
  useTagsViewStore().delView(router.currentRoute.value)
  router.go(-1)
}


</script>
<style lang="scss">
.goods-add {
  padding: 8px;
  padding-bottom: 80px;
  &-content {
    background: #fff;
    border-radius: 5px;
    padding: 12px;
  }
}
.from-sub-title{
  width:90%;
  padding:2px 0 24px;
  font-size: 16px;
  font-weight: bold;
}
.sku-img-wrap {
  img{
    width: 100px;
    height: 100px;
    object-fit: contain;
  }
}
.sku_item_info{
  flex: 1;
  margin-left: 8px;
  font-size: 12px;
  .sku_item_name{
    -webkit-box-orient: vertical;
    display: -webkit-box;
    overflow: hidden;
    text-overflow: ellipsis;
    -webkit-line-clamp: 1;
    white-space: normal !important;
    word-break: break-all;
    font-size: 16px;
    font-weight: 600;
  }
  .sku_item_type{
    color: #aaa;
  }
}
.teble_bottom{
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid #ebeef5;
  font-size: 12px;
  div{
    padding: 20px 8px;
  }
}
.footer-wrap{
  align-items: center;
    background-color: #fff;
    border-top: 1px solid #e8e8e8;
    bottom: 0;
    box-shadow: 0 -15px 10px -15px #e8e8e8;
    display: flex;
    left: 0;
    min-height: 60px;
    padding: 20px 30px 20px 20px;
    position: fixed;
    width: 100%;
    justify-content: end;
    z-index: 4;
}
</style>